package com.ztao.controller;

import com.heima.model.common.admin.dto.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.wemedia.pojos.WmChannel;
import com.ztao.service.WmChannelService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/v1/channel")
public class WmChannelController {
    @Resource
    private WmChannelService wmChannelService;
    @GetMapping("/channels")
    public ResponseResult findAll()
    {
        return wmChannelService.findAll();
    }

    @PostMapping("/list")
    public ResponseResult channel_list(@RequestBody ChannelDto dto) {
        return wmChannelService.findAll_channel(dto);
    }
    @PostMapping("/save")
    public ResponseResult add(@RequestBody WmChannel wmChannel) {
        return wmChannelService.add(wmChannel);
    }
    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmChannel wmChannel) {
        return wmChannelService.update(wmChannel);
    }
    @GetMapping("/del/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return wmChannelService.delete(id);
    }


}
